//
//  DetailsOfTheMeetingFromModel.m
//  Gxj
//
//  Created by 刘伟 on 2017/10/28.
//  Copyright © 2017年 wkq. All rights reserved.
//

#import "DetailsOfTheMeetingFromModel.h"

NSString *const kDetailsOfMeetingUserid      = @"userid";
NSString *const kDetailsOfMeetingTitle       = @"title";
NSString *const kDetailsOfMeetingIndustryid  = @"industryid";
NSString *const kDetailsOfMeetingCreate_date = @"create_date";
NSString *const kDetailsOfMeetingStart_date  = @"start_date";
NSString *const kDetailsOfMeetingInfo        = @"info";
NSString *const kDetailsOfMeetingViewnum     = @"viewnum";
NSString *const kDetailsOfMeetingSupportnum  = @"supportnum";
NSString *const kDetailsOfMeetingHead_img    = @"head_img";
NSString *const kDetailsOfMeetingNickname    = @"nickname";
NSString *const kDetailsOfMeetingImgsrc      = @"imgsrc";
NSString *const kDetailsOfMeetingFollow      = @"follow";
NSString *const kDetailsOfMeetingPosition    = @"position";

@implementation DetailsOfTheMeetingFromModel

@synthesize userid      = _userid;
@synthesize title       = _title;
@synthesize industryid  = _industryid;
@synthesize create_date = _create_date;
@synthesize start_date  = _start_date;
@synthesize info        = _info;
@synthesize viewnum     = _viewnum;
@synthesize supportnum  = _supportnum;
@synthesize head_img    = _head_img;
@synthesize nickname    = _nickname;
@synthesize imgsrc      = _imgsrc;
@synthesize follow      = _follow;
@synthesize position    = _position;

+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
    return [[self alloc] initWithDictionary:dict];
}
// 初始化
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
    self = [super init];
    if (self && [dict isKindOfClass:[NSDictionary class]])
    {
        _userid      = [self checkNilObjectForKey:kDetailsOfMeetingUserid                    fromDictionary:dict];
        _title       = [self checkNilObjectForKey:kDetailsOfMeetingTitle                     fromDictionary:dict];
        _industryid  = [self checkNilObjectForKey:kDetailsOfMeetingIndustryid                fromDictionary:dict];
        _create_date = [self checkNilObjectForKey:kDetailsOfMeetingCreate_date               fromDictionary:dict];
        _start_date  = [self checkNilObjectForKey:kDetailsOfMeetingStart_date                fromDictionary:dict];
        _info        = [self checkNilObjectForKey:kDetailsOfMeetingInfo                      fromDictionary:dict];
        _viewnum     = [self checkNilObjectForKey:kDetailsOfMeetingViewnum                   fromDictionary:dict];
        _supportnum  = [self checkNilObjectForKey:kDetailsOfMeetingSupportnum                fromDictionary:dict];
        _head_img    = [self checkNilObjectForKey:kDetailsOfMeetingHead_img                  fromDictionary:dict];
        _nickname    = [self checkNilObjectForKey:kDetailsOfMeetingNickname                  fromDictionary:dict];
        _imgsrc      = [self checkNilObjectForKey:kDetailsOfMeetingImgsrc                    fromDictionary:dict];
        _follow      = [self checkNilObjectForKey:kDetailsOfMeetingFollow                    fromDictionary:dict];
        _position    = [self checkNilObjectForKey:kDetailsOfMeetingPosition                  fromDictionary:dict];
    }
    return self;
}

- (NSDictionary *)dictionaryRepresentation
{
    NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
    [mutableDict setValue:_userid                                   forKey:kDetailsOfMeetingUserid];
    [mutableDict setValue:_title                                    forKey:kDetailsOfMeetingTitle];
    [mutableDict setValue:_create_date                              forKey:kDetailsOfMeetingCreate_date];
    [mutableDict setValue:_start_date                               forKey:kDetailsOfMeetingStart_date];
    [mutableDict setValue:_info                                     forKey:kDetailsOfMeetingInfo];
    [mutableDict setValue:_viewnum                                  forKey:kDetailsOfMeetingViewnum];
    [mutableDict setValue:_supportnum                               forKey:kDetailsOfMeetingSupportnum];
    [mutableDict setValue:_head_img                                 forKey:kDetailsOfMeetingHead_img];
    [mutableDict setValue:_nickname                                 forKey:kDetailsOfMeetingNickname];
    [mutableDict setValue:_follow                                   forKey:kDetailsOfMeetingFollow];
    [mutableDict setValue:_industryid                               forKey:kDetailsOfMeetingIndustryid];
    [mutableDict setValue:_imgsrc                                   forKey:kDetailsOfMeetingImgsrc];
    [mutableDict setValue:_position                                 forKey:kDetailsOfMeetingPosition];

    return [NSDictionary dictionaryWithDictionary:mutableDict];
}

- (id)checkNilObjectForKey:(id)key fromDictionary:(NSDictionary *)dict
{
    id object = [dict objectForKey:key];
    return [object isKindOfClass:[NSNull class]] ? nil : object;
}

- (NSString *)description
{
    return [NSString stringWithFormat:@"%@",[self dictionaryRepresentation]];
}


@end
